import requests

import config


# 获取登陆成功的令牌, 拼接到请求头, 返回
# 定义函数

def get_header():
    url = config.IHRM_URL + "/api/sys/login"
    json = {
        "mobile": "13800000002",
        "password": "888itcast.CN764%..."
    }
    resp = requests.post(url=url, json=json)
    # 从响应体中, 获取data的值
    token = resp.json().get("data")

    header = {"Context-Type": "application/json",
              "Authorization": "Bearer " + token}
    return header


if __name__ == '__main__':
    print(get_header())
